package com.project.book.admin.distributed.security.uaa.service;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

@Component
public class MyUserDetailsService implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        System.out.println("用户名username："+username);
        UserDetails userDetails = User.withUsername("zhangsan").password("$2a$10$n7D7/FX3S8U4jlX.jVX37eO6Q4gmIAOiYH.skVcH6nWvI3WzBBj/u").authorities("p1","p3").build();
        return userDetails;
    }
}
